package com.banshuibao.bsb_android.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.banshuibao.bsb_android.R;
import com.banshuibao.bsb_android.adapter.TaxFirstAdapter;
import com.banshuibao.bsb_android.adapter.TaxTypeAdapter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by zyh on 2018/5/23.
 */

public class TaxFirstActivity extends BaseActivity {

    private RecyclerView recyclerView;

    private TaxFirstAdapter adapter;

    private String money;

    private final static String[] moneys = {"3500", "4800"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tax_first);

        initData();
        initView();
    }

    private void initData() {
        money = getIntent().getStringExtra("money");
    }

    private void initView() {
        setTitleText("起征点");
        recyclerView = findViewById(R.id.recyclerView);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        adapter = new TaxFirstAdapter(this, money);
        recyclerView.setAdapter(adapter);

        setData();
    }

    private void setData() {
        List<String> list = new ArrayList<>(moneys.length);
        list.addAll(Arrays.asList(moneys));
        adapter.addData(list);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (adapter != null) {
            adapter.clear();
            adapter = null;
        }
    }
}
